//
//  XRRadioView.h
//  Auditory
//
//  Created by 寒竹子 on 15/5/6.
//  Copyright (c) 2015年 寒竹子. All rights reserved.
//  播放页面

#import <UIKit/UIKit.h>
#import "AudioPlayer.h"

@class FSPlaylistItem;
@class XRRadioView;
@class MusicModel;

@protocol XRRadioViewDelegate <NSObject>

// 随机、循环、单曲 播放
- (void)radioView:(XRRadioView *)view musicStop:(NSInteger)playType;
// 上一首
- (void)radioView:(XRRadioView *)view preSwitchMusic:(UIButton *)preButton;
// 下一首
- (void)radioView:(XRRadioView *)view nextSwitchMusic:(UIButton *)nextButton;

/*
    评论 收藏 分享 列表 代理方法
 */
- (void)radioViewCommentAction;
- (void)radioViewLikeAction;
- (void)radioViewShareAction;
- (void)radioViewListAction;

@end

typedef void (^BackBlock) (void);

@interface XRRadioView : UIView<AudioPlayerDelegate>
{
    UISlider * progress; // 显示播放进度
    NSTimer * _progressUpdateTimer; // 定时器
    NSTimer * playbackSeekTimer; // 拖动定时器
    double _seekToPoint; // 拖动进度
    
    BOOL _paused; // 是否暂停
    
    UILabel * _currentPlayBackTimeLabel; // 显示当前时间
    UILabel * _totalTimeLabel; // 显示总时间
    
    UIButton * _playButton; // 播放按钮
    UIButton * _preButton;  // 上一首
    UIButton * _nextButton; // 下一首
    
    UIButton * _playbackButton; // 随机、循环 切换按钮
    
    BOOL isPlaying;
    BOOL isPause;
    
    NSInteger playType; // 播放类型
    
    AudioPlayer * audioPlayer; // 播放器
}

@property (nonatomic, strong) MusicModel * model;
@property (nonatomic, strong) FSPlaylistItem * seletedPlayItem;
@property (nonatomic, weak)   id<XRRadioViewDelegate> delegate;

@property (nonatomic, copy) BackBlock callBlock;

// 播放音乐
- (void)playButtonAction;

@end
